import req from '@/utils/req'
import axios from 'axios'


export function getList(pageSize,pageNum,date1,date2) {
  return req.get('/crystalMessage/listByPage?pageSize='+pageSize+'&pageNum='+pageNum+'&date1='+date1+'&date2='+date2);
}
//导入
export function importExal(obj,fuc) {

  let config = {
    headers: {'Content-Type': 'multipart/form-data'},
    withCredentials:true
  }
  // 添加请求头
  axios.post(process.env.BASE_API+'/crystalMessage/import', obj, config)
    .then(response => {
      fuc(response.data);
    })
}

//新建
export function createRow(obj) {
  return req.post('/dept/add',obj)
}
//获得某条的详情
export function detailRow(obj) {
  return req.post('/crystalMessage/list',obj);
}
/*
export function detailRow(id,sheetName) {
  return req.post('/crystalMessage/list?id='+id+'&sheetName='+sheetName);
}
*/

/*export function detailRow(id,fuc) {

  let config = {
    headers: {'Content-Type': 'multipart/form-data'},
    withCredentials:true
  }
  // 添加请求头
  axios.get(process.env.BASE_API+'/crystalMessage/list?id='+id, config).then(data => {
      /!*fuc(data.data);*!/
      //return data
    })
}*/
//删除已经导入的行
export function delRow(id) {
  return req.post('/crystalMessage/delete?id='+id)
}
//确认导入
export function confirm(excelId) {
  return req.post('/crystalMessage/confirm?excelId='+excelId)
}

//获得要修改项的具体内容
export function editId(id) {
  return req.get('/crystalMessage/update?id='+id)
}
//修改某一项
export function updateMessage(obj,fuc) {

  let config = {
    headers: {'Content-Type': 'application/json'},
    withCredentials:true
  }
  // 添加请求头
  axios.post(process.env.BASE_API+'/crystalMessage/update', obj, config)
    .then(response => {
      fuc(response.data);
    })
}
//删除详情中的某条数据
export function delDetailRow(id) {
  return req.post('/crystalMessage/deleteMes?id='+id)
}
//详情中 搜索单晶编号
export function searchDetailRow(crystalNo,excelId) {
  return req.post('/crystalMessage/getByCrystalNo?crystalNo='+crystalNo+'&excelId='+excelId)
}
